package bitwise;

import java.util.Scanner;

/**
 * @Author: sfy
 * @Date: 2024/1/30 21:42
 * @Description: 位运算模板
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        while (n-- > 0) {
            int res = 0;
            int x = scanner.nextInt();
            while (x != 0) {
                x -= lowbit(x);
                res++;
            }
            System.out.print(res + " ");
        }
    }

    static int lowbit(int n) {
        return n & -n;
    }
}
